var mysql = require('mysql');

var connection = mysql.createConnection({
  host: '127.0.0.1',
  user: 'root',
  password: '1234',
  port: '3306',
  database: 'test'
}); 
 
connection.connect(function(){
  console.log('连接成功')
});

connection.query(function (res) {
  console.log(res)
});